
pkgname=vi
pkgver=050325
pkgrel=9
pkgdesc='The original ex/vi text editor.'
arch=('x86_64')
url='http://ex-vi.sourceforge.net/'
license=('custom:ex')
depends=('ncurses')
groups=('base')
options=('strip' '!libtool' 'emptydirs')
source=("http://downloads.sourceforge.net/sourceforge/ex-vi/ex-${pkgver}.tar.bz2"
        'navkeys.patch'
        'increase-tube.patch'
        'exrc.sample' 
        'preserve_dir.patch')
md5sums=('e668595254233e4d96811083a3e4e2f3'
         'aac133930047eafa4f28736cfaf976b3'
         'e596e05a00a24187b576e389fa1de45d'
         'd3b483c994d859232ce369b82a4b5668'
         '419a8755e0dd16e95542bc107e6d2b24')

build() {
  cd "${srcdir}/ex-${pkgver}"

  patch -p1 -i ${srcdir}/navkeys.patch
  patch -p0 -i ${srcdir}/increase-tube.patch
  patch -p1 -i ${srcdir}/preserve_dir.patch

  make PREFIX=/usr LIBEXECDIR=/usr/lib/ex PRESERVEDIR=/var/lib/ex \
      'FEATURES=-DCHDIR -DFASTTAG -DUCVISUAL -DMB -DBIT8' TERMLIB=ncurses
}

package() {
  cd "${srcdir}/ex-${pkgver}"

  make PREFIX=/usr LIBEXECDIR=/usr/lib/ex PRESERVEDIR=/var/lib/ex INSTALL=/usr/bin/install \
      DESTDIR="$pkgdir" install

  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
